package com.example.seven.mynews.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by seven on 16-6-30.
 */
public class MyPageAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragmentList;
    public MyPageAdapter(FragmentManager fm,List<Fragment> fragments) {
        super(fm);
        this.fragmentList = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        String title = fragmentList.get(position).getArguments().getString("title");
        return title;
    }
}
